package com.lwj.liwanjia.view.activity.dianpu;

import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.lwj.liwanjia.R;
import com.lwj.liwanjia.base.BaseActivity;
import com.lwj.liwanjia.bean.DianpuBean;
import com.lwj.liwanjia.utils.PopUtils;

import butterknife.BindView;
import butterknife.OnClick;

public class DianpuInforActivity extends BaseActivity {

    @BindView(R.id.tv_left)
    TextView tvLeft;
    @BindView(R.id.iv_right)
    ImageView ivRight;
    @BindView(R.id.iv_market)
    ImageView ivMarket;//超市图片
    @BindView(R.id.tv_name)
    TextView tvName;//超市名称
    @BindView(R.id.tv_guanzhu)
    TextView tvGuanzhu;//关注率
    @BindView(R.id.tv_haopinglv)
    TextView tvHaopinglv;//好评率
    @BindView(R.id.tv_address)
    TextView tvAddress;//地址
    @BindView(R.id.tv_boss)
    TextView tvBoss;//掌柜名
    @BindView(R.id.tv_dianpu_pingfen)
    TextView tvDianpuPingfen;//店铺评分
    @BindView(R.id.tv_fuwu)
    TextView tvFuwu;//服务态度
    @BindView(R.id.tv_wuliu)
    TextView tvWuliu;//物流服务

    @Override
    protected void initView() {
        tvLeft.setVisibility(View.VISIBLE);
        ivRight.setVisibility(View.VISIBLE);
        ivRight.setImageResource(R.mipmap.fenlei);
        DianpuBean.DataBean data = (DianpuBean.DataBean) getIntent().getSerializableExtra("info");
        Glide.with(this).load(data.getShopImage()).placeholder(R.mipmap.shop_image_1).into(ivMarket);
        tvName.setText(data.getShopName());
        tvGuanzhu.setText(data.getCollectNum() + "人关注");
        int v = (int) ((data.getGoodCommentRate()) * 100);
        tvHaopinglv.setText(v + "%");
        tvAddress.setText(data.getAddress());
        tvBoss.setText(data.getShopkeeper());
        tvDianpuPingfen.setText(data.getShopGrade() + "分");
        tvFuwu.setText(data.getServeGrade() + "分");
        tvWuliu.setText(data.getLogisticsGrade() + "分");
    }

    @Override
    protected void initData() {

    }

    @Override
    protected int getLayoutId() {
        return R.layout.activity_dianpu_infor;
    }


    @OnClick({R.id.tv_left, R.id.iv_right})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.tv_left:
                finish();
                break;
            case R.id.iv_right:
                PopUtils.getInstance().showPopupWindow(this, ivRight);
                break;
        }
    }
}
